//
// Created on 2024/12/31.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#include "ui_component_other_refresh_c_ability.h"
#include "common/common.h"
#include <arkui/native_interface.h>
#include <string>

static int32_t ON_REFRESH_EVENT_ID = 9001;
static int32_t ON_STATE_CHANGE_EVENT_ID = 9002;

namespace ArkUICApiDemo {
static auto CreateBaseText(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string &componentId)
{
    // 创建组件并添加到容器内
    auto baseText = nodeAPI->createNode(ARKUI_NODE_TEXT);
    ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}};
    ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}};
    ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)};
    ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(baseText, NODE_WIDTH, &width_item);
    nodeAPI->setAttribute(baseText, NODE_HEIGHT, &height_item);
    ArkUI_AttributeItem place_holder_item;
    place_holder_item.string = "callback print log";
    nodeAPI->setAttribute(baseText, NODE_TEXT_CONTENT, &place_holder_item);
    ArkUI_AttributeItem idStr;
    idStr.string = componentId.c_str();
    nodeAPI->setAttribute(baseText, NODE_ID, &idStr);
    return baseText;
}

static auto CreateBaseRefresh(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string &componentId)
{
    // 创建组件并添加到容器内
    auto baseRefresh = nodeAPI->createNode(ARKUI_NODE_REFRESH);
    ArkUI_NumberValue width_value[] = {{.f32 = SIZE_400}};
    ArkUI_NumberValue height_value[] = {{.f32 = SIZE_600}};
    ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)};
    ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(baseRefresh, NODE_WIDTH, &width_item);
    nodeAPI->setAttribute(baseRefresh, NODE_HEIGHT, &height_item);
    ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_LIGHT_BLUE}};
    ArkUI_AttributeItem background_color_item = {background_color_value,
        sizeof(background_color_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(baseRefresh, NODE_BACKGROUND_COLOR, &background_color_item);
    ArkUI_AttributeItem idStr;
    idStr.string = componentId.c_str();
    nodeAPI->setAttribute(baseRefresh, NODE_ID, &idStr);
    return baseRefresh;
}

static auto CreateRefreshOffset(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string &componentId)
{
    // 创建组件并添加到容器内
    auto baseRefresh = nodeAPI->createNode(ARKUI_NODE_REFRESH);
    ArkUI_NumberValue width_value[] = {{.f32 = SIZE_400}};
    ArkUI_NumberValue height_value[] = {{.f32 = 499}};
    ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)};
    ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(baseRefresh, NODE_WIDTH, &width_item);
    nodeAPI->setAttribute(baseRefresh, NODE_HEIGHT, &height_item);
    ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_LIGHT_BLUE}};
    ArkUI_AttributeItem background_color_item = {background_color_value,
        sizeof(background_color_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(baseRefresh, NODE_BACKGROUND_COLOR, &background_color_item);
    ArkUI_AttributeItem idStr;
    idStr.string = componentId.c_str();
    nodeAPI->setAttribute(baseRefresh, NODE_ID, &idStr);
    return baseRefresh;
}

static auto CreateText(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string &content)
{
    // 创建组件并添加到容器内
    auto baseText = nodeAPI->createNode(ARKUI_NODE_TEXT);
    ArkUI_NumberValue width_value[] = {{.f32 = SIZE_300}};
    ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}};
    ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)};
    ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(baseText, NODE_WIDTH, &width_item);
    nodeAPI->setAttribute(baseText, NODE_HEIGHT, &height_item);
    ArkUI_NumberValue align_value[] = {{.i32 = ARKUI_TEXT_ALIGNMENT_CENTER}};
    ArkUI_AttributeItem align_item = {align_value, sizeof(align_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(baseText, NODE_TEXT_ALIGN, &align_item);
    ArkUI_AttributeItem textStr;
    textStr.string = content.c_str();
    nodeAPI->setAttribute(baseText, NODE_TEXT_CONTENT, &textStr);
    return baseText;
}

static auto CreateListItem(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string &content)
{
    // 创建组件并添加到容器内
    auto listItem = nodeAPI->createNode(ARKUI_NODE_LIST_ITEM);
    ArkUI_NumberValue width_value[] = {{.f32 = SIZE_350}};
    ArkUI_NumberValue height_value[] = {{.f32 = SIZE_100}};
    ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)};
    ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(listItem, NODE_WIDTH, &width_item);
    nodeAPI->setAttribute(listItem, NODE_HEIGHT, &height_item);
    ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_WHITE}};
    ArkUI_AttributeItem background_color_item = {background_color_value,
        sizeof(background_color_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(listItem, NODE_BACKGROUND_COLOR, &background_color_item);
    ArkUI_NumberValue margin_value[] = {{.f32 = 10}};
    ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(listItem, NODE_MARGIN, &margin_item);
    auto text = CreateText(nodeAPI,content);
    nodeAPI->addChild(listItem, text);
    return listItem;
}

static auto CreateList(ArkUI_NativeNodeAPI_1 *nodeAPI, std::string &componentId)
{
    // 创建组件并添加到容器内
    auto baseList = nodeAPI->createNode(ARKUI_NODE_LIST);
    ArkUI_NumberValue width_value[] = {{.f32 = SIZE_400}};
    ArkUI_NumberValue height_value[] = {{.f32 = SIZE_600}};
    ArkUI_AttributeItem width_item = {width_value, sizeof(width_value) / sizeof(ArkUI_NumberValue)};
    ArkUI_AttributeItem height_item = {height_value, sizeof(height_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(baseList, NODE_WIDTH, &width_item);
    nodeAPI->setAttribute(baseList, NODE_HEIGHT, &height_item);
    ArkUI_AttributeItem idStr;
    idStr.string = componentId.c_str();
    nodeAPI->setAttribute(baseList, NODE_ID, &idStr);
    std::string listItem_1con = "listItem_1";
    std::string listItem_2con = "listItem_2";
    std::string listItem_3con = "listItem_3";
    std::string listItem_4con = "listItem_4";
    std::string listItem_5con = "listItem_5";
    auto listItem_1 = CreateListItem(nodeAPI,listItem_1con);
    auto listItem_2 = CreateListItem(nodeAPI,listItem_2con);
    auto listItem_3 = CreateListItem(nodeAPI,listItem_3con);
    auto listItem_4 = CreateListItem(nodeAPI,listItem_4con);
    auto listItem_5 = CreateListItem(nodeAPI,listItem_5con);
    nodeAPI->addChild(baseList, listItem_1);
    nodeAPI->addChild(baseList, listItem_2);
    nodeAPI->addChild(baseList, listItem_3);
    nodeAPI->addChild(baseList, listItem_4);
    nodeAPI->addChild(baseList, listItem_5);
    return baseList;
}

void UIComponentRefreshC::CreateNativeNodeRefreshC0010(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0010";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_down_value[] = {{.f32 = 1}};
    ArkUI_AttributeItem pull_down_item = {pull_down_value, sizeof(pull_down_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0010(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0010";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_to_refesh_value[] = {{.i32 = false}};
    ArkUI_AttributeItem pull_to_refesh_item = {pull_to_refesh_value, sizeof(pull_to_refesh_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_TO_REFRESH, &pull_to_refesh_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0020(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0020";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_to_refesh_value[] = {{.i32 = true}};
    ArkUI_AttributeItem pull_to_refesh_item = {pull_to_refesh_value, sizeof(pull_to_refesh_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_TO_REFRESH, &pull_to_refesh_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0030(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0030";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0040(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0040";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = 70}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0050(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0050";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = 20}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0060(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0060";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = 0}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0070(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0070";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = -1}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0080(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0080";
    auto refresh = CreateRefreshOffset(nodeAPI,refreshId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = 500}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0090(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0090";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = 60.5}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0100(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0100";
    std::string listId = "list0100";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    auto list = CreateList(nodeAPI, listId);
    nodeAPI->addChild(refresh, list);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0110(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0110";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_to_refesh_value[] = {{.i32 = true}};
    ArkUI_AttributeItem pull_to_refesh_item = {pull_to_refesh_value, sizeof(pull_to_refesh_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_TO_REFRESH, &pull_to_refesh_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0120(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0120";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue padding_value[] = {{.f32 = 5}};
    ArkUI_AttributeItem padding_item = {padding_value, sizeof(padding_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_PADDING, &padding_item);
    ArkUI_NumberValue margin_value[] = {{.f32 = 5}};
    ArkUI_AttributeItem margin_item = {margin_value, sizeof(margin_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_MARGIN, &margin_item);
    nodeAPI->addChild(rootNode, refresh);
}

namespace refreshEvent {
static ArkUI_NodeHandle refreshCom;
static ArkUI_NodeHandle textCom;
static void OnEventReceive(ArkUI_NodeEvent *event)
{
    if (event == nullptr) {
        OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "RefreshTest", "OnEventReceive: event is null");
        return;
    }

    int32_t eventId = OH_ArkUI_NodeEvent_GetTargetId(event);

    ArkUI_NativeNodeAPI_1 *nodeAPI = nullptr;
    OH_ArkUI_GetModuleInterface(ARKUI_NATIVE_NODE, ArkUI_NativeNodeAPI_1, nodeAPI);
    
    if (eventId == ON_STATE_CHANGE_EVENT_ID) {
        OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "RefreshTestOnStateChangeTest", "OnEventReceive");
        ArkUI_AttributeItem text_item = {};
        text_item.string = "RefreshTestOnStateChangeTest OnEventReceive";
        ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_YELLOW}};
        ArkUI_AttributeItem background_color_item = {background_color_value,
            sizeof(background_color_value) / sizeof(ArkUI_NumberValue)};
        nodeAPI->setAttribute(refreshCom, NODE_BACKGROUND_COLOR, &background_color_item);
        nodeAPI->setAttribute(textCom, NODE_TEXT_CONTENT, &text_item);
    }
    if (eventId == ON_REFRESH_EVENT_ID) {
        OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "RefreshTestOnRefreshingTest", "OnEventReceive");
        ArkUI_AttributeItem text_item = {};
        text_item.string = "RefreshTestOnRefreshingTest OnEventReceive";
        ArkUI_NumberValue background_color_value[] = {{.u32 = COLOR_YELLOW}};
        ArkUI_AttributeItem background_color_item = {background_color_value,
            sizeof(background_color_value) / sizeof(ArkUI_NumberValue)};
        nodeAPI->setAttribute(refreshCom, NODE_BACKGROUND_COLOR, &background_color_item);
        nodeAPI->setAttribute(textCom, NODE_TEXT_CONTENT, &text_item);
    }
}
} // namespace refreshEvent

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0130(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0130";
    std::string textId = "text0130";
    refreshEvent::refreshCom = CreateBaseRefresh(nodeAPI,refreshId);
    refreshEvent::textCom = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue pull_to_refesh_value[] = {{.i32 = false}};
    ArkUI_AttributeItem pull_to_refesh_item = {pull_to_refesh_value, sizeof(pull_to_refesh_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refreshEvent::refreshCom, NODE_REFRESH_PULL_TO_REFRESH, &pull_to_refesh_item);
    nodeAPI->addChild(rootNode, refreshEvent::refreshCom);
    nodeAPI->addChild(rootNode, refreshEvent::textCom);
    
    nodeAPI->registerNodeEvent(refreshEvent::refreshCom, NODE_REFRESH_STATE_CHANGE, ON_STATE_CHANGE_EVENT_ID, nullptr);
    nodeAPI->registerNodeEventReceiver(&refreshEvent::OnEventReceive);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0140(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0140";
    std::string textId = "text0140";
    refreshEvent::refreshCom = CreateBaseRefresh(nodeAPI,refreshId);
    refreshEvent::textCom = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue pull_to_refesh_value[] = {{.i32 = true}};
    ArkUI_AttributeItem pull_to_refesh_item = {pull_to_refesh_value, sizeof(pull_to_refesh_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refreshEvent::refreshCom, NODE_REFRESH_PULL_TO_REFRESH, &pull_to_refesh_item);
    ArkUI_NumberValue refesh_offset_value[] = {{.f32 = 64}};
    ArkUI_AttributeItem refesh_offset_item = {refesh_offset_value, sizeof(refesh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refreshEvent::refreshCom, NODE_REFRESH_OFFSET, &refesh_offset_item);
    nodeAPI->addChild(rootNode, refreshEvent::refreshCom);
    nodeAPI->addChild(rootNode, refreshEvent::textCom);
    
    nodeAPI->registerNodeEvent(refreshEvent::refreshCom, NODE_REFRESH_ON_REFRESH, ON_REFRESH_EVENT_ID, nullptr);
    nodeAPI->registerNodeEventReceiver(&refreshEvent::OnEventReceive);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0150(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0150";
    std::string textId = "text0150";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    auto text = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue pull_to_refesh_value[] = {{.i32 = true}};
    ArkUI_AttributeItem pull_to_refesh_item = {pull_to_refesh_value, sizeof(pull_to_refesh_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_TO_REFRESH, &pull_to_refesh_item);
    nodeAPI->addChild(rootNode, refresh);
    nodeAPI->addChild(rootNode, text);
    auto code = nodeAPI->resetAttribute(refresh, NODE_REFRESH_PULL_TO_REFRESH);
    std::string log = "reset: " + std::to_string(code);
    ArkUI_AttributeItem place_holder_item;
    place_holder_item.string = log.c_str();
    nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &place_holder_item);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0160(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0160";
    std::string textId = "text0160";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    auto text = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue pull_to_refesh_value[] = {{.i32 = true}};
    ArkUI_AttributeItem pull_to_refesh_item = {pull_to_refesh_value, sizeof(pull_to_refesh_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_TO_REFRESH, &pull_to_refesh_item);
    nodeAPI->addChild(rootNode, refresh);
    nodeAPI->addChild(rootNode, text);
    auto code = nodeAPI->getAttribute(refresh, NODE_REFRESH_PULL_TO_REFRESH);
    std::string log = "get: " + std::to_string(code->value[0].i32);
    ArkUI_AttributeItem place_holder_item;
    place_holder_item.string = log.c_str();
    nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &place_holder_item);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0170(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0170";
    std::string textId = "text0170";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    auto text = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = 64}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    auto code = nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
    nodeAPI->addChild(rootNode, text);
    std::string log = "set: " + std::to_string(code);
    ArkUI_AttributeItem place_holder_item;
    place_holder_item.string = log.c_str();
    nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &place_holder_item);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0180(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0180";
    std::string textId = "text0180";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    auto text = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = 64}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
    nodeAPI->addChild(rootNode, text);
    auto code = nodeAPI->resetAttribute(refresh, NODE_REFRESH_OFFSET);
    std::string log = "reset: " + std::to_string(code);
    ArkUI_AttributeItem place_holder_item;
    place_holder_item.string = log.c_str();
    nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &place_holder_item);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0190(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0190";
    std::string textId = "text0190";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    auto text = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue refresh_offset_value[] = {{.f32 = 64}};
    ArkUI_AttributeItem refresh_offset_item = {refresh_offset_value, sizeof(refresh_offset_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_OFFSET, &refresh_offset_item);
    nodeAPI->addChild(rootNode, refresh);
    nodeAPI->addChild(rootNode, text);
    auto code = nodeAPI->getAttribute(refresh, NODE_REFRESH_OFFSET);
    std::string log = "get: " + std::to_string(code->value[0].f32);
    ArkUI_AttributeItem place_holder_item;
    place_holder_item.string = log.c_str();
    nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &place_holder_item);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0200(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0200";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_down_value[] = {{.f32 = 1}};
    ArkUI_AttributeItem pull_down_item = {pull_down_value, sizeof(pull_down_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0210(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0210";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_down_value[] = {{.f32 = 0}};
    ArkUI_AttributeItem pull_down_item = {pull_down_value, sizeof(pull_down_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0220(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0220";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_down_value[] = {{.f32 = 0.5}};
    ArkUI_AttributeItem pull_down_item = {pull_down_value, sizeof(pull_down_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0230(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0230";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_down_value[] = {{.f32 = napi_undefined}};
    ArkUI_AttributeItem pull_down_item = {pull_down_value, sizeof(pull_down_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0240(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0240";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    ArkUI_NumberValue pull_down_value[] = {{.f32 = NULL}};
    ArkUI_AttributeItem pull_down_item = {pull_down_value, sizeof(pull_down_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    nodeAPI->addChild(rootNode, refresh);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0250(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0250";
    std::string textId = "text0250";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    auto text = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue pull_down_value[] = {{.f32 = 1}};
    ArkUI_AttributeItem pull_down_item = {pull_down_value, sizeof(pull_down_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    nodeAPI->addChild(rootNode, refresh);
    nodeAPI->addChild(rootNode, text);
    auto code = nodeAPI->getAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO);
    std::string log = "pulldownratio: " + std::to_string(code->value[0].f32);
    ArkUI_AttributeItem place_holder_item;
    place_holder_item.string = log.c_str();
    nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &place_holder_item);
}

void UIComponentRefreshC::CreateNativeNodeOtherRefreshCAbilty0260(ArkUI_NativeNodeAPI_1 *nodeAPI, ArkUI_NodeHandle& rootNode) {
    rootNode = nodeAPI->createNode(ARKUI_NODE_COLUMN);
    std::string refreshId = "refresh0260";
    std::string textId = "text0260";
    auto refresh = CreateBaseRefresh(nodeAPI,refreshId);
    auto text = CreateBaseText(nodeAPI, textId);
    ArkUI_NumberValue pull_down_value[] = {{.f32 = 1}};
    ArkUI_AttributeItem pull_down_item = {pull_down_value, sizeof(pull_down_value) / sizeof(ArkUI_NumberValue)};
    nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    nodeAPI->addChild(rootNode, refresh);
    nodeAPI->addChild(rootNode, text);
    nodeAPI->resetAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO);
    auto code = nodeAPI->setAttribute(refresh, NODE_REFRESH_PULL_DOWN_RATIO, &pull_down_item);
    std::string log = "set: " + std::to_string(code);
    ArkUI_AttributeItem place_holder_item;
    place_holder_item.string = log.c_str();
    nodeAPI->setAttribute(text, NODE_TEXT_CONTENT, &place_holder_item);
}
}